package com.imaker.utils;

import java.util.Map;

import com.imaker.domain.UserInfo;
import com.imaker.vo.CacheInfo;
import com.opensymphony.xwork2.ActionContext;

/**
 * 该类提供完善的权限过滤方法
 * @author mayh
 *
 */
public class AccessController {

	/**
	 * 对用户操作进行过滤
	 * @return
	 */
	public static String filtOperate(String webId){
		UserInfo user = (UserInfo)ActionContext.getContext().getSession().get("user");
		if(user==null){
			return "F";
		}
		CacheInfo ci = (CacheInfo)CacheUtils.get("ROLEOPERATE", user.getId());
		Map<String,String> cacheMap = ci.getOperate();
		String state = cacheMap.get(webId);
		if("T".equals(state)){
			return "T";
		}else {
		return "F";
		}
	}
	
}
